package tests;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

import urbanparks.User;

/**
 * Tests for the ParkManager class.
 * 
 * @author Dallas Rosson
 * @version 1.0 2/29/2012
 */
public class UserTest {
  
  /**
   * The user.
   */
  User my_user = new User();

  /**
   * Tests constructing the User through overloading.
   */
  @Test
  public void UserOverloadTest() {
    
    User user = new User("Clark", "Kent", "GetSuperman4U@JLA.org", 0);
    
    assertEquals("First name incorrect in User!", "Clark", user.getFirstName());
    assertEquals("Last name incorrect in User!", "Kent", user.getLastName());
    assertEquals("Email incorrect in User!", "GetSuperman4U@JLA.org", user.getEmailAddress());
    assertEquals("Permission incorrect in User!", 0, user.getPermissionLevel());
    
  }
  
  /**
   * Tests setting the name;
   */
  @Test
  public void UserNameTest() {
    
    my_user.setFirstName("Kal");
    
    assertEquals("First name did not set correctly!", "Kal", my_user.getFirstName());
    
    my_user.setLastName("El");
    
    assertEquals("Last name did not set correctly!", "El", my_user.getLastName());
    
  }
  
  /**
   * Test setting the email.
   */
  @Test
  public void UserEmailTest() {
    
    my_user.setEmailAddress("KryptonRocks@superdude.org");
    
    assertEquals("Email did not set correctly!", "KryptonRocks@superdude.org", my_user.getEmailAddress());

  }
  
  /**
   * Test setting permission level.
   */
  @Test
  public void UserPermissionTest() {
    
    my_user.setPermissionLevel(2);
    
    assertEquals("Permission level did not set correctly!", 2, my_user.getPermissionLevel());
    
  }
  
  /**
   * Tests getting the full name.
   */
  @Test
  public void UserFullNameTest() {
    
    my_user.setFirstName("Kal");
    my_user.setLastName("El");
    
    assertEquals("Full name did not return correctly!", "Kal El", my_user.getFullName());

  }

}
